/**
 * 
 */
package com.vector.ding.web.controller.report;

import java.util.List;

import net.sf.json.JSONObject;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.vector.ding.commons.util.front.BuiUtil;
import com.vector.ding.dao.mybatis.model.HjxxpfInfo;
import com.vector.ding.dao.mybatis.model.MtpjpfInfo;
import com.vector.ding.web.service.common.BearScoreService;
import com.vector.ding.web.service.common.MediaScoreService;

/**
 * @author vector
 *
 */
@Controller
@RequestMapping("/report/common")
public class CommonController {
	
	@Autowired
	BearScoreService bearService;
	
	@Autowired
	MediaScoreService mediaService;

	@RequestMapping(value="/mtpjPage.do", method=RequestMethod.GET)
	public ModelAndView getMtpjInfoPage(String comName) {
		ModelAndView mv = new ModelAndView();
		mv.addObject("comName", comName);
		mv.setViewName("/report/mtpj_info_mgr");
		return mv;
	}
	
	@RequestMapping(value="/hjxxPage.do", method=RequestMethod.GET)
	public ModelAndView getHjxxInfoPage(String comName) {
		ModelAndView mv = new ModelAndView();
		mv.addObject("comName", comName);
		mv.setViewName("/report/hjxx_info_mgr");
		return mv;
		//return new ModelAndView("/report/hjxx_info_mgr");
	}
	
	@ResponseBody
	@RequestMapping(value="/hjxx/getData.do", method=RequestMethod.POST)
	public JSONObject getHjxxInfo(String comName, int pageIndex, int limit) {
		List<HjxxpfInfo> list = bearService.getList(comName, pageIndex + 1, limit);
		return BuiUtil.gridAdapter(list);
	}
	
	@ResponseBody
	@RequestMapping(value="/mtpj/getData.do", method=RequestMethod.POST)
	public JSONObject getMtpjInfo(String comName, int pageIndex, int limit) {
		List<MtpjpfInfo> list = mediaService.getList(comName, pageIndex + 1, limit);
		return BuiUtil.gridAdapter(list);
	}
}
